// Player actor class
//--------------------------------
#ifndef PLAYER_H
#define PLAYER_H
#include "creature.h"
#include "bspecial.h"

class Player : public Creature {
public:

    static const uint INVENTORY_WIDTH;
    static const uint INVENTORY_HEIGHT;
    static const uint STATS_HEIGHT;

    Player( int sStr, int sDex, int sInt, int randomlyDistributedPoints );
    virtual ~Player();

protected:

    virtual bool Priority( int* priority ) const;
    virtual bool Symbol( IO::SymList* list ) const;
    virtual bool OnAction( int* speedMod );

private:

    int _inventoryPage;
    int _helpPage;

    typedef std::pair< int, ItemList > ItemInputMapEntry;
    typedef std::vector< ItemInputMapEntry > ItemInputMap;
    typedef std::pair< int, ActorList > ActorInputMapEntry;
    typedef std::vector< ActorInputMapEntry > ActorInputMap;

    static bool IIMPrioritySort( const ItemInputMapEntry&  less, const ItemInputMapEntry&  greater );
    static bool IIMCategorySort( const ItemInputMapEntry&  less, const ItemInputMapEntry&  greater );
    static bool AIMPrioritySort( const ActorInputMapEntry& less, const ActorInputMapEntry& greater );

    static void GetItemInputMap ( const ActorList& actors, ItemInputMap&  output, bool sortCategories = false );
    static void GetItemInputMap ( const ItemList&  items,  ItemInputMap&  output, bool sortCategories = false );
    static void GetActorInputMap( const ActorList& actors, ActorInputMap& output );
    std::string GetItemInputName ( const ItemList&  mapEntry );
    std::string GetActorInputName( const ActorList& mapEntry );
    bool InputTile( uint& x, uint& y, uint inputConfirm ) const;
    bool InputDirection( uint& d ) const;
    void FarLook( uint x, uint y );
    bool TryPush( uint direction, int* speedMod );
    bool TryPull( uint direction, int* speedMod );
    bool TryMove( uint direction, int* speedMod );
    bool TryStep( uint direction, int* speedMod );
    Behaved* GetBestFireSource();
    enum ITEM_DO_WHAT {
        LOOK,
        PICKUP,
        PICKUP_WIELD,
        DROP,
        WEAR,
        WIELD,
        REMOVE,
        EAT,
        LIGHT
    };
    uint InputItem( uint doWhat );
    uint RenderList( const std::string& title, const std::vector< std::string >& listing, const std::vector< IO::SymList >& symbols, int& page );
    void RenderHelp();
    void RenderStats();

    typedef std::pair< uchar, std::string > HelpEntry;
    static std::vector< HelpEntry > _help;

};

#endif
